home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / ODFDev / ODF / OS / FWFiles / SLFilRep.idl < prev    next >
Encoding:
Text File  |  1996-09-17  |  4.1 KB  |  170 lines  |  [TEXT/MPS ]

  1. //
  2. //    File:                SLFilRep.idl
  3. //
  4. //    Contains:            Interface for FW_OFile class
  5. //    Release Version:    $ ODF 2 $
  6. //
  7. //    Copyright:    (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  8. //
  9.  
  10. #ifndef SLFILREP_IDL
  11. #define SLFILREP_IDL
  12.  
  13. #ifndef SLSTDDEF_IDL
  14. #include "SLStdDef.idl"
  15. #endif
  16.  
  17. #ifndef SLREFCNT_IDL
  18. #include "SLRefCnt.idl"
  19. #endif
  20.  
  21. #ifndef SLFILESP_IDL
  22. #include "SLFileSp.idl"
  23. #endif
  24.  
  25.  
  26. //==============================================================================
  27. // Classes defined in this interface
  28. //==============================================================================
  29.  
  30. interface  FW_OFile;
  31.  
  32.  
  33. //==============================================================================
  34. // Classes used by this interface
  35. //==============================================================================
  36.  
  37. interface  FW_OFileSpecification;
  38.  
  39.  
  40. //==============================================================================
  41. // Types used by this interface
  42. //==============================================================================
  43.  
  44. typedef somToken FW_CPrivFileRep;
  45. typedef somToken FW_SAccessPermission;
  46. typedef somToken FW_PlatformFileHandle;
  47.  
  48.  
  49. //========================================================================================
  50. //    FW_OFile
  51. //
  52. //    Class holding representation for FW_OFileSink.  This is an implementation class 
  53. //    and should not be used in general.  Use the FW_OFileSink class instead.
  54. //========================================================================================
  55.  
  56. interface FW_OFile : FW_ORefCount
  57. {
  58.     void InitWithExclusiveAccess(in FW_OFileSpecification fileSpecification,
  59.                                  in FW_Boolean allowCreate);
  60.         // Open with exclusive access 
  61.  
  62.     void InitWithPermissions(in FW_OFileSpecification fileSpecification,
  63.                              in FW_SAccessPermission* permission,
  64.                              in FW_Boolean allowCreate);
  65.         // Open with specified permissions.
  66.         
  67.  
  68.  
  69.     //===========================================================
  70.     // Read/Write
  71.     //===========================================================
  72.  
  73.     void Read(in void* destination, in long count);
  74.         // Read 'count' bytes from current position to 'destination' and 
  75.         // increment current position by 'count'.
  76.         
  77.     void Write(in void* source, in long count);
  78.         // Write 'count' bytes from 'source' to current file position.
  79.  
  80.  
  81.     //===========================================================
  82.     // File Positioning
  83.     //===========================================================
  84.         
  85.     long GetLength();
  86.         // Return the logical size of the file.
  87.                                     
  88.     void SetLength(in long length);
  89.         // Return the logical size of the file.
  90.  
  91.     long GetPosition();
  92.         // Return current file position.
  93.         
  94.     void SetPosition(in long positioningMode,
  95.                      in long markOffset);
  96.         // Set current file position using mode.
  97.         
  98.     long BytesToEndOfFile();
  99.         // Returns the number of bytes from the current position to the
  100.         //   end of the file.
  101.         
  102.  
  103.     //===========================================================
  104.     // Accessor methods
  105.     //===========================================================
  106.  
  107.     void GetPermissions(out FW_SAccessPermission thePerms);
  108.         // Returns the permissions used to open this file.
  109.  
  110.     FW_OFileSpecification GetFileSpecification();
  111.         // Returns a reference to the file.  This routine is primarily used for 
  112.         //   exception handling.
  113.  
  114.     FW_PlatformFileHandle* GetFileHandle();
  115.         // Returns the native platform handle to the file.
  116.         
  117.  
  118.     //===========================================================
  119.     // Operators
  120.     //===========================================================
  121.  
  122.     FW_Boolean IsEqual(in FW_OFile theOtherFile);
  123.         // Equality operator.
  124.  
  125.  
  126. #ifdef __SOMIDL__
  127. implementation
  128.     {
  129.         functionprefix = FW_OFile__;
  130.         
  131.         override:
  132.             somInit,
  133.             somUninit;
  134.             
  135.         releaseorder:
  136.             somInit,
  137.             somUninit,
  138.  
  139.             InitWithExclusiveAccess,
  140.             InitWithPermissions,
  141.             Read,
  142.             Write,
  143.             GetLength,
  144.             SetLength,
  145.             GetPosition,
  146.             SetPosition,
  147.             BytesToEndOfFile,
  148.             GetPermissions,
  149.             GetFileSpecification,
  150.             GetFileHandle,
  151.             IsEqual;
  152.  
  153.         majorversion = 1;
  154.         minorversion = 0;
  155.  
  156.         passthru C_xh =
  157.             "";
  158.  
  159.         passthru C_xih =
  160.             "class FW_CPrivFileRep;";
  161.  
  162. #ifdef __PRIVATE__
  163.         FW_CPrivFileRep *fRep;
  164. #endif
  165.   };
  166. #endif //# __SOMIDL__
  167. };
  168.  
  169. #endif
  170.